package com.yxq.mdt.app.modules.socialcontact.presenter;

import com.yxq.mdt.app.base.BasePresenter;
import com.yxq.mdt.app.modules.socialcontact.bean.AddCommentBean;
import com.yxq.mdt.app.modules.socialcontact.bean.CircleTopicListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.GroupDetailBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SubscribersListBean;
import com.yxq.mdt.app.modules.socialcontact.model.MainSocialContactModel;
import com.yxq.mdt.app.net.ApiModel;

import okhttp3.MediaType;
import okhttp3.RequestBody;

public class GroupDetailPresenter extends BasePresenter<GroupDetailContract.View, MainSocialContactModel> implements GroupDetailContract.Presenter {
    /**
     * 如果当前页面同时需要 Model 层和 View 层,则使用此构造函数(默认)
     *
     * @param rootView
     * @param model
     */
    public GroupDetailPresenter(GroupDetailContract.View rootView, MainSocialContactModel model) {
        super(rootView, model);
    }


    @Override
    public void getTopList(String groupId, int pageNum, int pageSize, String orderByClause) {
        mBaseModel.getTopicHottestList(groupId, pageNum, pageSize, orderByClause, new ApiModel.CommonCallback<CircleTopicListBean>() {
            @Override
            public void onSuccess(CircleTopicListBean groupDetailBean) {
                mRootView.onLoadTopListSuccess(groupDetailBean);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadTopListFailed();
            }
        });
    }

    @Override
    public void getGroupDetail(String topicId, String topicDesc) {
        mBaseModel.getBrowseLisGroupDetail(topicId, topicDesc, new ApiModel.CommonCallback<GroupDetailBean>() {
            @Override
            public void onSuccess(GroupDetailBean groupDetailBean) {
                mRootView.onLoadGroupDetailSuccess(groupDetailBean);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadGroupDetailFailed();
            }
        });
    }
}
